package com.xzzz.irda.guardcat.core.metric.bufferpool;

import java.io.Serializable;

/**
 * 缓冲区信息
 *
 * @author xzzz
 * @since 1.0.0
 */
public class BufferInfo implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 缓冲区名称
     */
    private final String name;

    /**
     * 缓冲区数量
     */
    private final long count;

    /**
     * 缓冲区总容量【单位：字节】
     */
    private final long totalCapacity;

    /**
     * 缓冲区内存使用量【单位：字节】
     */
    private final long memoryUsed;

    public BufferInfo(String name, long count, long totalCapacity, long memoryUsed) {
        this.name = name;
        this.count = count;
        this.totalCapacity = totalCapacity;
        this.memoryUsed = memoryUsed;
    }

    public String getName() {
        return name;
    }

    public long getCount() {
        return count;
    }

    public long getTotalCapacity() {
        return totalCapacity;
    }

    public long getMemoryUsed() {
        return memoryUsed;
    }

    @Override
    public String toString() {
        return "缓冲区信息{" +
                "名称='" + name + '\'' +
                ", 数量=" + count +
                ", 总容量=" + totalCapacity + "(" + (totalCapacity >> 10) + "K) " +
                ", 内存使用量=" + memoryUsed + "(" + (memoryUsed >> 10) + "K) " +
                '}';
    }
}
